eventcontroller: Remove some unnecessary casts
authorTimm Bäder <mail@baedert.org>
Wed, 29 Apr 2020 06:11:07 +0000 (08:11 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 5 May 2020 06:20:10 +0000 (08:20 +0200)
Instead of comparing two GtkWidget*s by casting the two GtkNative*s, we
can as well compare two GtkNative*s. Also if gtk_widget_get_native()
returns NULL, the code previously failed.

gtk/gtkeventcontroller.c

index 37a048ec811c20db1c377d104ed951476ccdc119..52d91719c2e7def0ee9206389481012bef6e1539 100644 (file)
@@ -250,14 +250,14 @@ static gboolean
 same_native (GtkWidget *widget,
              GtkWidget *target)
 {
-  GtkWidget *native;
-  GtkWidget *native2;
+  GtkNative *native;
+  GtkNative *native2;
 
   if (!widget || !target)
     return TRUE;
 
-  native = GTK_WIDGET (gtk_widget_get_native (widget));
-  native2 = GTK_WIDGET (gtk_widget_get_native (target));
+  native = gtk_widget_get_native (widget);
+  native2 = gtk_widget_get_native (target);
 
   return native == native2;
 }